package com.tony.controller;

import com.tony.vo.Person;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class Index {

    @RequestMapping("/")
    public String index(Model model){
        Person singlePerson = new Person("tony",20);
        model.addAttribute("singlePerson",singlePerson);

        List<Person> lists= new ArrayList<Person>();
        Person person1 = new Person("p1",11);
        Person person2 = new Person("p2",22);
        Person person3 = new Person("p3",33);
        lists.add(person1);
        lists.add(person2);
        lists.add(person3);

        model.addAttribute("people",lists);
        return "index";
    }
}
